package com.enseirb.bdxmap.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class UserDatabaseHelper extends SQLiteOpenHelper {

	private	static final String CB_NAME				= "user_markers.db";
	private	static final int	DATABASE_VERSION	= 1;
	public	static final String TABLE_USER			= "user_marker";
	public	static final String COL_ID				= "id";
	public	static final String COL_LAT				= "latitude";
	public	static final String COL_LON				= "longitude";
	public	static final String COL_NAME			= "name";
	public	static final String COL_DESCR			= "description";
	public	static final String[] COL_ALL			= {COL_ID, COL_LAT, COL_LON, COL_NAME, COL_DESCR};
	
	private static final String CREATE_BDD = "CREATE TABLE " + TABLE_USER + " ("
											+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " 
											+ COL_LAT + " REAL NOT NULL, "
											+ COL_LON + " REAL NOT NULL, "
											+ COL_NAME + " TEXT,"
											+ COL_DESCR + " TEXT);";
	
	public UserDatabaseHelper(Context context) {
		super(context, CB_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_BDD);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		this.onCreate(db);
	}

}
